package org.javaboy.vhr.controller.salary;

import org.javaboy.vhr.responseBean.ServerResponse;
import org.javaboy.vhr.service.EmployeeService;
import org.javaboy.vhr.service.SalaryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 员工账套controller
 */
@RestController
@RequestMapping("/salary/sobcfg")
public class SobcfgController {
    @Autowired
    EmployeeService employeeService;

    /**
     * 分页查询员工账套信息
     * @return
     */
    @GetMapping("/")
    public ServerResponse getEmployeeAndSalary(@RequestParam(defaultValue = "1") Integer page, @RequestParam(defaultValue = "10") Integer size){
        return employeeService.getEmployeeAndSalary(page,size);
    }

    /**
     * 修改员工账套信息
     * @param empId
     * @param salaryId
     * @return
     */
    @PutMapping("/")
    public ServerResponse updateEmployeeSalary(Integer empId,Integer salaryId){
        int result = employeeService.updateEmployeeSalary(empId,salaryId);
        if(result>=1){
            return ServerResponse.success("修改成功");
        }else{
            return ServerResponse.error(1000,"修改失败");
        }
    }
}
